export const state = () => ({
    posts: []
})
  
export const mutations = {
    getPost(state, index){
        return state.posts[index]
    },

    addPost(state, post){
        state.posts.unshift(post);
        if(state.posts.length > 5) {
            state.posts.length = 5;
        }
    },

    deletePost(state, post){
        state.posts = state.posts.filter(v => {
            return (post.content !== v.content) || (post.title !== v.title);
        })

        console.log(state.posts)
    }
}